package com.xtjc.recsyslog.netty.encoder;

import com.xtjc.recsyslog.util.ConverUtil;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class CustomDataEncoder extends MessageToByteEncoder<String[]> {
    @Override
    protected void encode(ChannelHandlerContext channelHandlerContext, String[] bytes, ByteBuf out) throws Exception {
//        log.info("发送数据：{}", (Object) bytes);
        byte[] res = ConverUtil.hexArrayToByteArray(bytes);
//        log.info("发送数据10进制：{}",res);
        out.writeBytes(res);
    }
}
